<template>
  <div class="organization-activities">
    <div class="page-header">
      <h2>活动管理</h2>
      <el-button type="primary" @click="createActivity">
        创建活动
      </el-button>
    </div>
    
    <el-table :data="activities">
      <el-table-column prop="name" label="活动名称" />
      <el-table-column prop="date" label="活动日期" />
      <el-table-column prop="status" label="状态" />
      <el-table-column prop="participants" label="报名人数" />
      <el-table-column label="操作">
        <template #default="scope">
          <el-button type="primary" size="small" @click="editActivity(scope.row)">
            编辑
          </el-button>
          <el-button type="danger" size="small" @click="deleteActivity(scope.row)">
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'

const activities = ref([
  {
    id: 1,
    name: '海滩清理活动',
    date: '2024-04-01',
    status: '报名中',
    participants: 20
  }
])

const createActivity = () => {
  // 实现创建活动的逻辑
}

const editActivity = (row) => {
  // 实现编辑活动的逻辑
}

const deleteActivity = (row) => {
  ElMessageBox.confirm(
    '确定要删除该活动吗？',
    '警告',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }
  ).then(() => {
    // 实现删除活动的逻辑
    ElMessage.success('删除成功')
  }).catch(() => {})
}
</script>

<style scoped>
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
</style> 